<?php

namespace App\Models\OpenShop\Wanggui;

use App\Models\BaseModel;
use App\Models\Common\ResourcesModel;
use App\Models\Traits\KfSoftDeletes;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasMany;

class WangguiSiteDistrictModel extends BaseModel
{
    use HasFactory;
    use KfSoftDeletes;

    protected $table = 'wanggui_site_district';

    protected $fillable = [
        'name',
        'isEmptyShop',
        'isDeleted',
    ];

    const IS_EMPTY_SHOP_OK  = 1;   //有空铺位
    const IS_EMPTY_SHOP_OFF = 0;   //无空铺位

    const IS_EMPTY_SHOP_MAPPING = [
        self::IS_EMPTY_SHOP_OFF => '无空铺',
        self::IS_EMPTY_SHOP_OK  => '有空铺',
    ];

    public function resourceRel(): HasMany
    {
        return $this->hasMany(ResourcesModel::class, 'businessId', 'id')->where('module', ResourcesModel::MODULE_TYPE_WG_AUDIT)->where('business', ResourcesModel::BUSINESS_OPEN_DISTRICT);
    }

}
